{% extends "base.html" %}
{% load staticfiles %}


{% block title %}
	图灵系统 - 问题详情
{% endblock %}

{% block style %}
{% endblock %}


{% block content %}

	<div class="container question">
		<!--问题区-->
		<div class="question_summary" >
			<div id="question-header" style="padding-bottom: 25px;">
				{% if Login %}
				<div style="margin: 5px 2px; " class="pull-right">
					<button onclick="likeit()" type="button" class="btn btn-default btn-sm pull-right" style="padding: 1px 6px;padding-top:6px;">
						<span class="glyphicon glyphicon-heart" style="color: #777777;font-size: 15px;align-content: center;">

						</span itemprop="likeCount">
					</button>
				</div>
				{% endif %}
		        <h1 itemprop="name" style="color:  #313c2c; font-weight: bold; ">
		        	<span class="question-hyperlink" style="font-size: 23px">
		        		<label></label>
		        		{{question.QuestionAbstract}}
		        	</span>
		        </h1>

		        <label>&nbsp;&nbsp;标签：</label>
		        {% for tag in tags %}
		        	<a href="" class="sum_post-tag" title="" rel="">{{tag}}</a>
		        {% endfor %}
			</div>

			<div><img src="{% static 'image/灰栏.png' %}"></div>




			<div class="comment-box" style="margin-top: 10px;">
			<br>
				<div class="comment-box_left" style="">
					<img src="{% static 'image/111.png' %}" class="img-responsive" alt="" >
				</div>
				<div class="comment-box_right">
					<h5 style="font_weight:bold;color:#313c2c">
						<a href="/name">{{question.QuizzerName}}</a>
						<span class="pull-right" style="font_weight:bold;">asked
							<span title="2016-11-22 16:41:53Z" class="relativetime">
								{{questionTime}}
							</span>
						</span>
					</h5>
					<div style="padding-top: 20px;">
				    	<div class="post-text" itemprop="text" style="float:left;width:90%;">

							{{question.QuestionContent|safe}}
							<p></p>
						</div>
						
					</div>
						{% if Login %}
				    <div class="pull-right" style="width: 100%">
							<td class="votecell" style="float:left;width:8%; margin-right: 2%" >
								<div class="vote">
								    <input type="hidden" name="_id_" value="40747226">

								    <div style="padding: 2px; "  align="right">
									    <button onclick="QuestionPraise()" type="button" class="btn btn-default btn-sm ">
											<span class="glyphicon glyphicon-thumbs-up" style="padding-top: 8px； font-size: 16px">
											</span itemprop="upCount">
											&emsp;
											<span id="QuestionPraise" style="font-size: 13px">
												{{question.PraiseNum}}
											</span>
											</button>
										</div>

									<div style="padding: 2px; " align="right">
										<button onclick="QuestionOppose()" id="{{question.QuestionID}}" type="button" class="btn btn-default btn-sm QuestionOpperation ">
											<span class="glyphicon glyphicon-thumbs-down"  style="padding-top: 8px； font-size: 16px">
											</span itemprop="downCount">
											&emsp;
											<span id="QuestionOppose" style="font-size: 13px ">
												{{question.OpposeNum}}
											</span>
										</button>
									</div>

									</div>
				          </td>
					    </div>
							{% endif %}
				
					<div class="clearfix"></div>
				</div>
			</div>
		</div>

		<br>

		<div><img src="{% static 'image/灰栏.png' %}"></div>


		<!--评论区-->
		<div class="comment_section">
		 	<h3 style="color:  #313c2c;
		 			font-weight: bold;
		 			border-bottom: 1px solid #eee;
		 			padding-bottom: 5px">
		 		{{question.AnswerNum}}个回答
		 	</h3>
		 	<ul class="comment-list">
		 		{% for answer in answers %}
                <li style=" padding-top:15px; padding-bottom:5px;border-bottom: 1px solid #eee;">
			     	<div class="comment-box">
			       		<div class="comment-box_left">
			       			<img src="{% static 'image/111.png' %}" class="img-responsive" alt=""/>
			       		</div>
			        	<div class="comment-box_right">
			        		<h5 style="font_weight:bold;">
			        			<a href="#">
			        				{{answer.ResponderName}}
			        			</a>
			        			<span class="pull-right" style="font_weight:bold;">
			        				reply
			        				<span title="2016-11-22 16:41:53Z" class="relativetime">
			        					{{answer.answerTime}}
			        				</span>
			        			</span>
			        		</h5>
		            		<p>{{answer.AnswerContent|safe}}</p>
							{% if Login %}
							<span class="pull-right">

								<td class="votecell">
							    <div class="vote">
							      <div style="margin: 2px" align="right">
								      <button id="{{answer.AnswerID}}" type="button" class="btn btn-default btn-sm AnswerPraise">
										  		<span class="glyphicon glyphicon-thumbs-up" style="padding-top: 8px； font-size: 16px">


										  		</span itemprop="upCount">
										  		&emsp;
										  		<span id="{{answer.AnswerID}}" class="Praise" style="font-size: 13px ">
									  				{{answer.PraiseNum}}
									  			</span>
											</button>
										</div>
										<div style="margin: 2px" align="right">
											<button type="button" id="{{answer.AnswerID}}" class="btn btn-default btn-sm AnswerOppose">
										  		<span class="glyphicon glyphicon-thumbs-down" style="padding-top: 8px； font-size: 16px">


										  		</span itemprop="downCount">
										  		&emsp;
										  		<span id="{{answer.AnswerID}}" class="Oppose" style="font-size: 13px ">
									  				{{answer.OpposeNum}}
									  			</span>
											</button>
										</div>
									</div>
			            </td>

			        </span>
							{% endif %}
			        </div>
			      	</div>
			      	<div class="clearfix"> </div>
				</li>
				{% endfor %}
	    	</ul>
    	</div>
        <!--我的回复-->
        <div id="mainbar" class="container question" >
			<form id="post-form" class="post-form" action="/answerSubmit/" method="post">
    			<input type="hidden" name="qualityBanWarningShown" value="False"/>
    			<input type="hidden" name="priorAttemptCount" value="0"/>
    			<input type="hidden" name="warntags" />
    			<input name="qID" type="text" style="display:none;" value="{{question.QuestionID}}" />
				<div id="post-editor" >
					<div style="position: relative;">
		            	<table>
		            		<tr>
                				<h3 style="color:  #313c2c; font-weight: bold;">
                    				我的评论
                				</h3>
            				</tr>
                     	   	<tr>
				  				<textarea cols="80" id="content" name="post-text" class="ckeditor" rows="10"></textarea>
						    	<script type="text/javascript">
	 					    		function getContent(){
				        				return CKEDITOR.instances.content.getBody().getText();
				        			}
				   				</script>
              				</tr>
		        		</table>
					</div>
				</div>
        		<div style="">
        			<br>
            		<div id="question-only-section" class="pull-right" >
			    		<div class="form-item" style="">
			    			{% if not Liked %}
			        		<td>
			            		<input name="receive_email" type="checkbox"/>
			            		<label for="" class="chkbx_text" style="display: inline">
			            			邮箱接收最新回复
			            		</label>
			        		</td>
			        		{% endif %}
			        		<!-- <td>
			            		<input id="" type="checkbox"/>
			            		<label for="" class="chkbx_text" style="display: inline">
			            			匿名发布
			            		</label>
							</td> -->
			        		<td>
			        			<button id="submit-button" class="form-sumbit">发布</button>
			        		</td>
			        	</div>
              		</div>
    			</div>
			</form>
		</div>

	</div>


{% endblock %}



{% block other_script %}
<script type="text/javascript" src="{%static 'ckeditor/ckeditor.js' %}"></script>
<script type="text/javascript" src = "{% static 'js/buttonFunctions.js' %}" ></script>
<script type="text/javascript">
	$('#post-form').one('submit', function() {
		console.log("clicked");
		$(this).find('button[id="submit-button"]').attr('disabled','disabled');
	});
</script>

<!-- code_highlight -->
<script type="text/javascript" src="{%static 'code_highlight/power.js' %}"></script>
<script type="text/javascript" src="{%static 'code_highlight/prettify.js' %}"></script>
<link rel="stylesheet" type="text/css" href="{%static 'code_highlight/font-awesome.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{%static 'code_highlight/prettify.css' %}"/>
<link rel="stylesheet" type="text/css" href="{%static 'code_highlight/style_2.css' %}"/>
{% endblock %}
